package com.zzh.phone.scale.eventhandling;

import android.os.Bundle;
import android.widget.Toast;

import com.zzh.lib.views.image.ImageSource;
import com.zzh.lib.views.image.SubsamplingScaleImageView;
import com.zzh.phone.hviews.R;
import com.zzh.phone.hviews.R.id;
import com.zzh.phone.scale.AbstractPagesActivity;
import com.zzh.phone.scale.Page;

import java.util.Arrays;

public class EventHandlingActivity extends AbstractPagesActivity {

    public EventHandlingActivity() {
        super(R.string.event_title, R.layout.pages_activity, Arrays.asList(
                new Page(R.string.event_p1_subtitle, R.string.event_p1_text),
                new Page(R.string.event_p2_subtitle, R.string.event_p2_text),
                new Page(R.string.event_p3_subtitle, R.string.event_p3_text)
        ));
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SubsamplingScaleImageView imageView = findViewById(id.imageView);
        imageView.setImage(ImageSource.asset("sanmartino.jpg"));
        imageView.setOnClickListener(v -> Toast.makeText(v.getContext(), "Clicked", Toast.LENGTH_SHORT).show());
        imageView.setOnLongClickListener(v -> {
            Toast.makeText(v.getContext(), "Long clicked", Toast.LENGTH_SHORT).show();
            return true;
        });
    }

}
